<?php
//模块插件类
//插件功能类，由系统调用，实现具体功能。
defined('BY_JYA') or exit('error');
class core_jy_jdpm extends plugin{
	public function __construct($name){
		global $_RQ;
		parent::__construct($name);
		if($_RQ['fromuser']){
			$isfromuser = pdo_getcolumn('jy_jdpm_member', array('mid' => intval($_RQ['fromuser'])),'mid');
			if($isfromuser){
				$_SESSION['fromuser'] = intval($_RQ['fromuser']);
			}else{
				$_SESSION['fromuser'] =0;
			}
		}
		//if($_RQ['is_access']){
			set_exi(function($message,$type='success',$action='',$url=''){
				if(is_array($message) && !$message['0']){
					$message['pluginset']=$this->plugin_setting('basic');
				}
				exi($message,$type,$action,$url);
			});
		//}
		
	}
	public function array_sort($arr , $keys , $type = 'asc') {
        $keysvalue = $new_array = array();
        foreach ($arr as $k => $v) {
            $keysvalue[$k] = $v[$keys];
        }
        if ($type == 'asc') {
            asort($keysvalue);
        } else {
            arsort($keysvalue);
        }
        reset($keysvalue);
        foreach ($keysvalue as $k => $v) {
            $new_array[$k] = $arr[$k];
        }
        return $new_array;
    }	
}	
	/*global $_RQ;	
	$user=pdo_get('core_users',array('id'=>$_SESSION['uid']));	
	if($user['type']==1 && $_SESSION['this']=='manage'){
		$perms=pdo_get('jy_jdpm_perm_user',array('mid'=>$_SESSION['uid']),array('perms','perms2'));
		$url=$_RQ['plugin'].'/'.$_RQ['action'].'/';
		if(!strexists($perms['perms'],$url ) && !strexists($perms['perms2'],$url) && $url!='jy_jdpm/error/'){
			exi('无访问权限!'.$url,'error','error/');
		}
	}*/
	
require ROOT_D . '/addons/jy_jdpm/customfunc.php';
?>